import { EMClient } from "../index";
import { useImStore } from "@/stores/modules/im";
export const imPresenceListener = () => {
  //处理登陆用户状态的变更
  const imStore = useImStore();
  const getUserPresence = status => {
    imStore.handlePresenceChanges(imStore, status);
  };
  const mountPresenceEventListener = () => {
    EMClient.addEventHandler("presenceStatusChange", {
      onPresenceStatusChange: status => {
        getUserPresence(...status);
      }
    });
  };
  return {
    mountPresenceEventListener
  };
};
